//nuxt.js3登录认证接口

import sequelize from "~/db";

// 全局变量
export default defineEventHandler(async (event) => {
    const body = await readBody(event)
    if(body.username === 'admin' && body.password === '123456'){
        event.context.session.username = 'admin';
        console.log('login',event.context.session)
        return {status:200,username:'admin'}
    }
    else{
        return {status:300,username:''}
    }
    // console.log('hello',event.context.session)
    //   return sequelize.query("select * from student");
  })

